<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>数字和字符串</title>
</head>
<body>
	<script type="text/javascript">
		/*
		var a = 'mjj' + 521;
		alert(a);
		alert(typeof a);
		*/

		/*
		var b = '18' + '40';
		alert(b);
		alert(typeof b);
		*/
		// 1.隐式转换 数值转字符串
		var num = 234;
		var myStr = num + "";
		// alert(typeof myStr);

		// 2.toString() 数值转字符串
		var myStr2 = num.toString();
		// alert(typeof myStr2);

		// 字符串转数值
		var myNum = Number(num);
		// alert(typeof myNum);
		

		var n = '2424fhfh';
		var a = Number(n);
		alert(typeof a);//NaN      Not a number




	</script>
	
</body>
</html>